import { GET_DATA_OVERVIEW, GET_HERO_LIST } from '../../constants/ActionTypes'
// import { combineReducers } from 'redux'


const initialState = {
    dataOverviewData: {
        "0":{},
        "1":{},
        "2":{},
        "3":{},
    },
    heroList:[],
    heroTotal:0
}


const couponAnalysisReducer = (state = initialState, action) =>{ 
    switch (action.type){
        case GET_DATA_OVERVIEW: 
            let  _dataObj = Object.assign({},state.dataOverviewData,{
                [action.dataType?action.dataType:"0"]:action.dataOverviewData
            })
            return Object.assign({},state,{dataOverviewData:_dataObj})           
        case GET_HERO_LIST:
            return Object.assign({},state,{
                heroList:action.heroData.recordList,
                heroTotal:action.heroData.totalCount,
            })
        default:
            return {...state}
   }
}

export const dataOverviewData = state => state.dataOverviewData

export const heroList = state => state.heroList

export const heroTotal = state => state.heroTotal


export default couponAnalysisReducer
